# 依赖及其初始化
apt install build-essential devscripts dpkg-dev debhelper
apt build-dep apt

# 再次安装依赖
apt install \
    zlib1g-dev liblzma-dev libbz2-dev \
    libssl-dev \
    libcurl4-openssl-dev \
    libgpg-error-dev libgcrypt20-dev \
    libzstd-dev \
    libxxhash-dev \
    build-essential devscripts dpkg-dev libxxhash-dev

dpkg-buildpackage -b -uc -us

# 编译
mkdir build-static
cd build-static

cmake .. \
  -DCMAKE_EXE_LINKER_FLAGS="-static -static-libgcc -static-libstdc++" \
  -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
  -DCMAKE_C_FLAGS="-static" \
  -DCMAKE_CXX_FLAGS="-static"

make -j$(nproc)
